package de.szut.kundenverwaltung;

import java.awt.Font;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class KundenPanel extends JPanel{
	private JLabel title;
	private JLabel vorname;
	private JLabel nachname;
	private JTextField field_vorname;
	private JTextField field_nachname;
	private JSlider rabatt;
	private JLabel rabatt_text;
	private JCheckBox katalog;
	private JButton ende;
	private JButton drucken;
	private JLabel kundenstatus;
	private JRadioButton bronze;
	private JRadioButton silber;
	private JRadioButton gold;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	public KundenPanel(){
		
		setLayout(null);

		
		title = new JLabel("Kundenverwaltung");
		title.setHorizontalAlignment(SwingConstants.CENTER);
		title.setFont(new Font("Verdana", Font.BOLD, 18));
		title.setBounds(99, 11, 225, 35);
		add(title);
		
		vorname = new JLabel("Name:");
		vorname.setFont(new Font("Tahoma", Font.PLAIN, 13));
		vorname.setBounds(43, 75, 46, 14);
		add(vorname);
		
		nachname = new JLabel("Vorname: ");
		nachname.setFont(new Font("Tahoma", Font.PLAIN, 13));
		nachname.setBounds(43, 97, 61, 14);
		add(nachname);
		
		field_vorname = new JTextField();
		field_vorname.setBounds(114, 73, 86, 20);
		field_vorname.setColumns(10);
		add(field_vorname);
		
		field_nachname = new JTextField();
		field_nachname.setBounds(114, 95, 86, 20);
		add(field_nachname);
		
		rabatt_text = new JLabel("Rabatt: 0%");
		rabatt_text.setFont(new Font("Tahoma", Font.BOLD, 13));
		rabatt_text.setBounds(43, 128, 117, 14);
		add(rabatt_text);
		
		rabatt = new JSlider();
		rabatt.setValue(0);
		rabatt.addChangeListener(new SliderListener(rabatt_text));
		rabatt.setBounds(43, 160, 200, 24);
		add(rabatt);
		
		katalog = new JCheckBox("Katalog schicken?");
		katalog.setBounds(43, 193, 158, 23);
		add(katalog);
		
		ende = new JButton("Ende");
		ende.addActionListener(new ActionButton(Kundenverwaltung.getInstance()));
		ende.setBounds(43, 239, 91, 23);
		add(ende);
		
		kundenstatus = new JLabel("Kundenstatus");
		kundenstatus.setFont(new Font("Tahoma", Font.BOLD, 13));
		kundenstatus.setBounds(320, 76, 94, 14);
		add(kundenstatus);
		
		gold = new JRadioButton("Goldkunde");
		buttonGroup.add(gold);
		gold.setBounds(320, 94, 109, 23);
		add(gold);
		
		silber = new JRadioButton("Silberkunde");
		buttonGroup.add(silber);
		silber.setBounds(320, 119, 109, 23);
		add(silber);
		
		bronze = new JRadioButton("Bronze");
		buttonGroup.add(bronze);
		bronze.setBounds(320, 145, 109, 23);
		add(bronze);
		
		drucken = new JButton("Kundendaten drucken");
		drucken.addActionListener(new ButtonDrucken(rabatt_text, field_nachname, field_vorname, katalog, gold, silber, bronze));
		drucken.setBounds(252, 239, 180, 23);
		add(drucken);
	}
}
